package redis;

import com.alibaba.fastjson.JSONObject;
import redis.clients.jedis.Jedis;

public class RedisDemo1 {
    /**
     * Json序列化 反序列化
     */
    public void test1(){
        Jedis jedis = new Jedis("139.186.73.78");
        System.out.println("连接成功");
        JSONObject json = new JSONObject();

        json.put("key1","value1");
        json.put("key2","value2");
        json.put("key3","value3");

        jedis.set("json1",json.toString());

        System.out.println(jedis.get("json1"));
    }

    public static void main(String[] args) {
        RedisDemo1 run = new RedisDemo1();
        run.test1();
    }

}
